package vip.web3.common.enums;

import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * 功能描述: 交易对状态枚举
 */
@Getter
@RequiredArgsConstructor
public enum OperateEnum {

    /**
     * 记录操作相关
     */
    TYPE1(1, "充值", "+ 参投余额"),
    TYPE2(2, "提现", "- 提现余额"),
    TYPE3(3, "余额划转", "- 提现余额, + 参投余额"),
    TYPE4(4, "下单支出", "- 参投余额"),
    TYPE5(5, "静态奖励", "+ 提现余额"),
    TYPE6(6, "推荐奖励", "+ 提现余额 CNY"),
    TYPE7(7, "等级分红", "+ 提现余额 CNY"),
    TYPE8(8, "业绩分红", "+ 提现余额 CNY"),
    TYPE9(9, "合金原料奖", "+ 提现余额 CNY"),
    TYPE10(10, "月个人充值", "+ 提现余额"),


    OPERATE_TYPE1(1, "CNY", "操作人民币"),
    OPERATE_TYPE2(2, "BSC-USDT", "操作人BSC-USDT"),
    OPERATE_TYPE3(3, "TRON-USDT", "操作人TRON-USDT"),

    /**
     * 后台操作相关
     */
    ADMIN21(21, "后台操作", "+/- 参投余额 CNY"),
    ADMIN22(22, "后台操作", "+/- 参投余额 USDT"),
    ADMIN23(23, "后台操作", "+/- 提现余额 CNY"),
    ADMIN24(24, "后台操作", "+/- 提现余额 USDT"),

    ADMIN1(30, "后台操作", "+/- 资金账户 USDT"),
    ADMIN2(31, "后台操作", "+/- 量化账户 USDT"),
    ADMIN3(32, "后台操作", "+/- 资金账户 BBT"),
    ADMIN4(33, "后台操作", "+/- 量化账户 BBT"),
    ADMIN5(34, "后台操作", "+/- BBT 额度"),
    ADMIN6(35, "后台操作", "+/- OTC 额度"),
    ADMIN7(36, "后台操作", "+/- 基金份额额度"),
    ADMIN8(37, "后台提现驳回", "+ 资金账户 USDT"),
    ;

    private final int type;
    private final String desc;
    private final String mark;

    public static OperateEnum get(Integer type) {
        for (OperateEnum statusEnum : OperateEnum.values()) {
            if (Integer.valueOf(statusEnum.getType()).equals(type)) {
                return statusEnum;
            }
        }
        return null;
    }

    /**
     * 根据传入的状态获取描述信息
     *
     * @param type
     * @return
     */
    public static String getDescByType(int type) {
        for (OperateEnum statusEnum : OperateEnum.values()) {
            if (statusEnum.getType() == type) {
                return statusEnum.getDesc();
            }
        }
        return null;
    }

    public static List<Integer> rechargeTypes() {
        return Lists.newArrayList(OperateEnum.TYPE1.type);
    }

    public static List<Integer> withdrawTypes() {
        return Lists.newArrayList(OperateEnum.TYPE2.type);
    }

    public static List<Integer> flowTypes() {
        List<Integer> list = Lists.newArrayList(OperateEnum.TYPE3.type);
        list.add(OperateEnum.TYPE5.type);
        list.addAll(brokerageTypes());
        return list;
    }

    public static List<Integer> brokerageTypes() {
        return Lists.newArrayList(/*OperateEnum.TYPE5.type, */OperateEnum.TYPE6.type, OperateEnum.TYPE7.type, OperateEnum.TYPE8.type, OperateEnum.TYPE9.type);
    }

    public static List<Integer> sysFlowTypes() {
        return Lists.newArrayList(OperateEnum.TYPE3.type, OperateEnum.TYPE4.type, OperateEnum.TYPE5.type,
                OperateEnum.TYPE6.type, OperateEnum.TYPE7.type, OperateEnum.TYPE8.type, OperateEnum.TYPE9.type,OperateEnum.ADMIN23.type,OperateEnum.ADMIN24.type);
    }

}